package com.weayer.service;

import com.weayer.dto.ResponseResult;
import com.weayer.remote.ServicePriceClient;
import com.weayer.request.ForecastPriceDTO;
import com.weayer.response.ForecastPriceResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description: Api服务 - 乘客 - 计价service
 * @author: Weayer
 **/
@Service
public class ForecastPriceService {
    @Autowired
    ServicePriceClient servicePriceClient;

    public ResponseResult forecastPrice(String depLongitude, String depLatitude, String desLongitude, String desLatitude,
                                        String cityCode, String vehicleType){
        // 调用计价服务，计算价格
        ForecastPriceDTO forecastPriceDTO = new ForecastPriceDTO(
                depLongitude, depLatitude, desLongitude, desLatitude, cityCode, vehicleType);
        ResponseResult<ForecastPriceResponse> forecast = servicePriceClient.forecastPrice(forecastPriceDTO);

        return ResponseResult.success(forecast.getData());
    }
}
